// Created by Joe on 2017/8/4.

app.directive(
    'loading',
    function () {
        return {
            restrict: 'E',
            scope: {
                width: '@loadWidth',
                height: '@loadHeight',
                top: '@loadTop',
                mask: '=bgMask',
                infoHidden: '='
            },
            template: '<div class="loading__setting">' +
            '<div class="loading__content">' +
            '<div class="loading__icon"></div><p class="loading__notice">数据加载中，请稍后...</p>' +
            '</div></div>',
            link: function (scope, ele) {
                if (scope.mask) {
                    ele.find('.loading__setting').css({
                        background: '#000',
                        opacity: .8
                    });
                }

                if (scope.infoHidden) {
                    ele.find('.loading__notice').css('display', 'none');
                }

                ele.find('.loading__setting').css({
                    width: scope.width || '100%',
                    height: scope.height || '100%'
                });

                ele.find('.loading__content').css({
                    top: scope.top
                });
            }
        };
    }
);